// TDPsolaDoc.cpp : implementation of the CTDPsolaDoc class
//

#include "stdafx.h"
#include "TDPsola.h"

#include "TDPsolaDoc.h"
#include "Mmsystem.h"
#include "WaveFile.h"
#include "MyConstants.h"
#include "Psola.h"
#include "TDPsolaView.h"


#include "Winsock2.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


CString CTDPsolaDoc::CsDirectoryOfFile = "";
CString CTDPsolaDoc::CS_DBFileName = "";

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaDoc

IMPLEMENT_DYNCREATE(CTDPsolaDoc, CDocument)

BEGIN_MESSAGE_MAP(CTDPsolaDoc, CDocument)
	//{{AFX_MSG_MAP(CTDPsolaDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaDoc construction/destruction

CTDPsolaDoc::CTDPsolaDoc()
{
	// TODO: add one-time construction code here
	//Open dababase file DB_FILENAME difined in the file MyConstants.h
//	CString CsDirectoryOfFile;
	char cBuff[256];
	GetCurrentDirectory(256,cBuff);
	CsDirectoryOfFile = cBuff;
	
	//CS_DBFileName = CsDirectoryOfFile + '\\' + "Vn.mgr";
	CS_DBFileName = CsDirectoryOfFile + '\\' + "Vn_DemiSyl.mgr";
	//	AfxMessageBox(CS_DBFileName);
	//if(!CPsola::DB_Open(DB_FILENAME)){
	if(!CPsola::DB_Open(CS_DBFileName)){
		MessageBox(::AfxGetMainWnd()->m_hWnd,CPsola::GetLastError().GetBuffer(0),0,MB_OK | MB_ICONEXCLAMATION);
	}
	//Issue the buffer temporel to 2 channels of signal

}

CTDPsolaDoc::~CTDPsolaDoc()
{

	//PlaySound( NULL, NULL, SND_ASYNC | SND_NODEFAULT );
}




/////////////////////////////////////////////////////////////////////////////
// CTDPsolaDoc serialization

void CTDPsolaDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here

	}
}

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaDoc diagnostics

#ifdef _DEBUG
void CTDPsolaDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CTDPsolaDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaDoc commands



